package GameEngine.Drawables.Tile;

import java.util.Comparator;


public class TileImageComparator implements Comparator<Tile> {

	@Override
	public int compare(Tile t1, Tile t2) {
		// null nach hinten sortieren
		if ((t1 == null) && (t2 == null)) {
			return 0;
		}
		if ((t1 != null) && (t2 == null)) {
			return -1;
		}
		if ((t1 == null) && (t2 != null)) {
			return 1;
		}
		
		// hier die echten Werte vergleichen
		if (t1.getPosX() < t2.getPosX()) {
			return -1;
		} else {
			if (t1.getPosX() > t2.getPosX()) {
				return 1;
			}
		}
		return 0;
	}
}